/*在界面上有一个按钮(show)和文本编辑器，
当按下按钮时，文本编辑器会显示 “Hello qt”*/

#include "mainWindow.h"
#include <QDebug>

mainWindow::mainWindow(QWidget * parent,Qt::WindowFlags f)
:QWidget(parent,f)
{
    this->layout=new QVBoxLayout(this);

    this->textEdit=new QTextEdit(this);
    
    this->pushButton=new QPushButton(this);
    this->pushButton->setText("send");

    this->layout->addWidget(textEdit);
    this->layout->addWidget(pushButton);

    this->setLayout(layout);

    connect(this->pushButton,SIGNAL(pressed()),this,SLOT(myPressed()));
    connect(this->pushButton,SIGNAL(released()),this,SLOT(myReleased()));

}

void mainWindow::myPressed()
{
    this->textEdit->append("Hello qt");
}
void mainWindow::myReleased()
{
    this->textEdit->clear();
}